<template>
	<view class="content padding">
		<view class="padding ffffff border_2 flexbetween">
			<view class="text_x color_ling white_nowrap">物流公司</view>
			<view class="flexleft" @click="show=true">
				<input class="text_a textright margin_right1" type="text" placeholder="请选择物流公司"
					placeholder-style="color: #999999;font-size: 28rpx;" disabled v-model="express_name">
				<u-icon name="arrow-right" color="rgba(175, 175, 175, 1)" size="12"></u-icon>
			</view>
		</view>
		<view class="padding ffffff border_2 flexbetween margin_top">
			<view class="text_x color_ling white_nowrap">运单号</view>
			<input class="text_a textright" type="text" placeholder="请输入运单号" placeholder-style="color: #999999;font-size: 28rpx;" v-model="express_no">
		</view>
		<!-- <view class="btn" @click="submit">确定发货</view> -->
		<view class="footer padding ffffff">
			<view class="footerButton" @click="submit">确认发货</view>
		</view>
		<u-picker :show="show" :columns="columns" keyName="name" title="物流公司" @cancel="show=false" @confirm="confirm"></u-picker>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				show: false,
				columns: [],
				listid:"",
				express_id:"",
				express_name:"",
				express_no:"",
			}
		},
		onLoad(options) {
			let _this = this
			_this.listid = options.id
			this.getkdList()
		},
		methods:{
			submit(){
				if(this.express_name==""){
					httpRequest.toast("请选择快递公司！")
					return false
				}
				if(this.express_no==""){
					httpRequest.toast("请输入运单号！")
					return false
				}
				httpRequest.request('/api/shop.goods_order/deliver', 'POST', {
					order_id:this.listid,
					express_id:this.express_id,
					express_no:this.express_no,
				}, false, false, true).then(res => {
					httpRequest.toast(res.msg)
					if(res.code==1){
						setTimeout(()=>{
							uni.navigateBack(1)
						},500)
					}
				})
			},
			getkdList(){
				 httpRequest.request('/api/shop.goods_order/get_express', 'GET', {
				 }, false, false, true).then(res => {
				 	this.columns.push(res.data)
				 })
			},
			confirm(e){
				this.show=false  
				this.express_id = e.value[0].id
				this.express_name = e.value[0].name
			}
		}
	}
</script>

<style lang="scss" scoped>
	
	.btn {
		width: 90vw;
		color: #fff;
		background-color: rgba(243, 39, 28, 1);
		padding: 20rpx 0;
		text-align: center;
		border-radius: 44rpx;
		z-index: 100;
		margin: 300rpx 20rpx 0;
	}
</style>